﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace NuiDicomPlayer.Subviews
{
    /// <summary>
    /// Interaction logic for PataintRecordWindow.xaml
    /// </summary>
    public partial class PataintRecordWindow : SubviewBase
    {
        private delegate void OnPerformVoiceCommand(String Command);
        public PataintRecordWindow()
        {
            InitializeComponent();
        }

        internal void UpdatePatainInformations(Vtk.DicomImageInfo DicomInfo)
        {
            if (DicomInfo != null)
            {
                txtPName.Content = DicomInfo.PataintName;
                filepath.Content = DicomInfo.DicomFolderName;
                txtdepth.Content = DicomInfo.TotalCoronalSlice.ToString();
                txtheight.Content = DicomInfo.TotalSagetalSlice.ToString();
                txtwidth.Content = DicomInfo.TotalAxialSlice.ToString();
                txtAge.Content = DicomInfo.Age;
                txtGender.Content = DicomInfo.Sex;

                /////////////////////////////////////////////////////
                org_color_level_txt.Content = DicomInfo.ColorLevel.ToString();
                org_color_window_txt.Content = DicomInfo.ColorWindow.ToString();
                imapgepos_txt.Content = "[" + DicomInfo.ImagePostion[0].ToString() + "," + DicomInfo.ImagePostion[1].ToString() + "," + DicomInfo.ImagePostion[2].ToString()+"]";
                imapgeor_txt.Content = "[" + DicomInfo.ImageOr[0].ToString() + "," + DicomInfo.ImageOr[1].ToString() + "," + DicomInfo.ImageOr[2].ToString() + "," + DicomInfo.ImageOr[3].ToString() + "," + DicomInfo.ImageOr[4].ToString() + "," + DicomInfo.ImageOr[5].ToString() + "]";
            }



        }

        private void quitBtn_OnHandFiredEvent_1(object sender, EventArgs e)
        {
            Biomedica.Nui.ui.UserControlTransition.DoControlTransitionAnimation(this, 0, -1000, 1, 300, OnLocalEndTransitionEnded);
        }
        public override void ShowView()
        {
            App.ActiveWindow = this;
            Biomedica.Nui.ui.UserControlTransition.DoControlTransitionAnimation(this, -1000, 0, 1, 300, null);
        }

        #region Speech

        private void PerformVoiceCommand(string voicecommand)
        {
            switch (voicecommand)
            {

                case ("kinect close"):
                    this.Dispatcher.Invoke(new EventHandler(quitBtn_OnHandFiredEvent_1), this, new EventArgs());
                    break;

            }
        }

        internal override void DoSpeechCommand(System.Speech.Recognition.RecognitionResult recognitionResult)
        {
            this.Dispatcher.Invoke(new OnPerformVoiceCommand(PerformVoiceCommand), recognitionResult.Text);
        }

        #endregion
       
    }
}
